/** 
 * Project: Auswertungstool
 * File: Rovio.java
 *
 * Description: Diese Klasse verwaltet die Kommunikation mit der Application
 *
 * last change: 14.06.2012
 * 
 * @author ebueht
 *
 */
package Lan;

import java.io.IOException;
import java.net.Socket;

public class ApplicationAnbindung{
    //Klassenvariablen
    private Socket clientSocket;
    private Communicator communicator;
    private String serverName;
    
    //Konstruktor
    public ApplicationAnbindung(String serverName) throws IOException{
    	
    	//Klassenvariablen Initialisierung
    	this.serverName = serverName;
        
        //Mit Application verbinden
        try{
            clientSocket = new Socket(serverName, 9999);
            System.out.println("Connected with Socket: "+clientSocket.getLocalAddress());
        }
        catch(Exception e){
            System.out.println("Couldn't create connect with this Server!");
            System.exit(0);
        }
        
        //Communication Initialisierung und Start
        communicator = new Communicator(this, clientSocket);
        communicator.start();
    }
}

